{{- define "image_pull_secret" }}
{{- printf "{\"auths\": {\"%s\": {\"username\": \"%s\",\"password\": \"%s\", \"auth\": \"%s\"}}}" .Values.image_registry.addr .Values.image_registry.user .Values.image_registry.passwd (printf "%s:%s" .Values.image_registry.user .Values.image_registry.passwd | b64enc) | b64enc }}
{{- end }}

{{- define "images.mysql_etcd_image" }}
{{- if eq .Values.cpu_mode "amd64" -}}
{{- print .Values.images_amd64.mysql_etcd_image }}
{{- else if eq .Values.cpu_mode "arm64" -}}
{{- print .Values.images_arm64.mysql_etcd_image }}
{{- end -}}
{{- end }}

{{- define "images.mysql_poc_images" }}
{{- if eq .Values.cpu_mode "amd64" -}}
{{- print .Values.images_amd64.mysql_poc_images }}
{{- else if eq .Values.cpu_mode "arm64" -}}
{{- print .Values.images_arm64.mysql_poc_images }}
{{- end -}}
{{- end }}

{{- define "images.mysql_node_image" }}
{{- if eq .Values.cpu_mode "amd64" -}}
{{- print .Values.images_amd64.mysql_node_image }}
{{- else if eq .Values.cpu_mode "arm64" -}}
{{- print .Values.images_arm64.mysql_node_image }}
{{- end -}}
{{- end }}

{{- define "images.mysql_manager_image" }}
{{- if eq .Values.cpu_mode "amd64" -}}
{{- print .Values.images_amd64.mysql_manager_image }}
{{- else if eq .Values.cpu_mode "arm64" -}}
{{- print .Values.images_arm64.mysql_manager_image }}
{{- end -}}
{{- end }}

{{- define "images.mysql_exporter_image" }}
{{- if eq .Values.cpu_mode "amd64" -}}
{{- print .Values.images_amd64.mysql_exporter_image }}
{{- else if eq .Values.cpu_mode "arm64" -}}
{{- print .Values.images_arm64.mysql_exporter_image }}
{{- end -}}
{{- end }}

{{- define "images.skiff_tools" }}
{{- if eq .Values.cpu_mode "amd64" -}}
{{- print .Values.images_amd64.skiff_tools }}
{{- else if eq .Values.cpu_mode "arm64" -}}
{{- print .Values.images_arm64.skiff_tools }}
{{- end -}}
{{- end }}
